<!DOCTYPE html>
<html lang="en">
<head>


</head>
<body>
//---------------------------------------------------引入下拉框数据-----------------------------------------------//
            <div class="layui-col-xs4">
                <label class="layui-form-label">label</label>
                <div class="layui-input-block">
                    <select class="layui-input" name="businessType" id="businessType" lay-filter="businessType" lay-search="businessType">
                    </select>
                </div>
            </div>
            <script type="text/javascript">
                function pageload() {
                    layui.extend({
                        pca: '../../inc/layui/lay/pca'
                    })
                    layui.use(['pca'], function () {
                        Comm.pca = layui.pca;
                        var data =[];
                        //请求AJAX填充数据
                        AJAX.GET("/admin/dict/getpidSelect?dictpid=3", function (a) {
                            if (a.code == 1) {
                                data = a.data;
                                Comm.pca.init('select[name=businessType]', '', '', data,'');
                            }
                        })
                    })
                }
                //下拉监听{需要在lay-from下才有效}
                Comm.form.on('select(businessType)', function (res) {
                    layui.use(['pca'], function () {

                    })
                })
            </script>

//---------------------------------------------------单输入框弹框-----------------------------------------------//
            <script type="text/javascript">
            layer.prompt({
                    formType: 2,
                    value: '',
                    title: '请输入处理内容',
                    area: ['400px', '100px'] //自定义文本域宽高
                }, function(value, index, elem){
                    Comm.loading(true);
                    // var url = '/common/Message/sysmessageadd?dictname='+value;
                    //执行 ajax del 操作
                    AJAX.POST("/admin/opinion/projectFeedDeal", { complainid:obj.data.complainid,status:1,remark:value }, function (d) {
                        if (d.code == 1) {
                            //刷新列表
                            Comm.table.reload('table');
                            Comm.msg("操作成功", 1)
                        } else {
                            Comm.msg(d.msg, 5)
                        }
                    })
                    layer.close(index);
                });
            </script>
//---------------------------------------------------自定义弹出框-----------------------------------------------//
        <script type="text/html" id="formTpl">
            <div id="form" class="layui-form" style="margin-top: 20px;margin-right:20px;">
                <div class="layui-form-item">
                    <label class="layui-form-label">原密码</label>
                    <div class="layui-input-block">
                        <input value="" type="password" name="oldpassword" lay-verify="required" id="oldpassword" autocomplete="off" placeholder="请输入原密码" class="layui-input"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">新密码</label>
                    <div class="layui-input-block">
                        <input value="" type="password" name="newPwdTwo" lay-verify="required" id="newPwdTwo" autocomplete="off" placeholder="请输入新密码" class="layui-input"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">新密码</label>
                    <div class="layui-input-block">
                        <input value="" type="password" name="newPwdone" lay-verify="required" id="newPwdone" autocomplete="off" placeholder="请再次输入新密码" class="layui-input"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-layer-btn ">
                        <button class="layui-btn layui-btn-danger" lay-submit="" lay-filter="sub">保存</button>
                        <button class="layui-btn layui-btn-primary" id="closeform">清空</button>
                    </div>
                </div>
            </div>
        </script>
        <script type="text/javascript">
            Comm.laytpl($("#formTpl").html()).render({}, function (html) {
                //多窗口模式，层叠置顶
                Comm.layer.open({
                    type: 1,
                    title: '修改密码',
                    area: ['390px', '320px'],
                    shade: 0.3,
                    //maxmin: true,
                    content: html,
                    zIndex: layer.zIndex,  //重点1
                    success: function (layero) {
                        //验证必填项
                        Comm.form.verify();
                        //监听指定开关
                        Comm.form.on('submit(sub)', function (data) {
                            if (data.field.newPwdTwo != data.field.newPwdone) {
                                Comm.layer.msg("两次新密码输入不同!", { icon: 5 })
                                return
                            }
                            Comm.loading(true);
                            AJAX.POST('/admin/user/resetpwdtwo', data.field, function (d) {
                                if (d.code == 1) {
                                    Comm.layer.closeAll();
                                    Comm.layer.msg("修改成功!", { icon: 1 })
                                    Comm.loading(false);
                                    //执行重载
                                } else {
                                    Comm.layer.msg(d.msg, { icon: 5 })
                                    Comm.loading(false);
                                }
                            })
                        });
                        $("#closeform").click(function () {
                            Comm.layer.closeAll();
                        })
                    },
                });
            })
        </script>
//---------------------------------------------------下载模板(导出excel)-----------------------------------------------//
        <button class="layui-btn layui-btn-danger" onclick="downmodel()" >批量考勤模板</button>
        <script type="text/javascript">
            function downmodel(){
                window.location.href = config.root + "/admin/positionday/exportBatchDayMould?applyids=" + ids +
                    "&startdate=" + data.field.startdate +
                    "&day=" + data.field.day;
            }
        </script>

//---------------------------------------------------导入模板(导入excel)-----------------------------------------------//
        <button type="button" class="layui-btn" id="inportmodel" title="重复日期的数据不会被录入">导入数据</button>
        <script type="text/javascript">
            function downmodel(){
                Comm.upload.render({
                    elem: '#inportmodel',
                    field: 'file',
                    accept: 'file',
                    acceptMime: 'application/vnd.ms-excel',
                    multiple: false,
                    url: config.ossroot,
                    before: function (obj) {
                        layer.load();
                    },
                    done: function (d) {
                        console.log(this.data)
                        AJAX.GET("/admin/positionday/inportPositionDayMould?filename=" + this.data.key+"&name="+ this.data.name, function (a) {
                            if (a.code == 1) {
                                Comm.table.reload('table');
                                Comm.layer.msg("处理完成!", { icon: 1 })
                            }else{
                                Comm.layer.msg(a.msg, { icon: 5 })
                                // Comm.table.reload('table');
                            }
                        })
                    },
                    error: function () {
                        //请求异常回调
                        layer.closeAll('loading'); //关闭loading
                    }
                });
            }
        </script>
//---------------------------------------------------待补充-----------------------------------------------//
</body>
</html>



